Update bayes.py#2
Conversation
LINE #234 - fixed "TypeError: only integer scalar arrays can be converted to a scalar index" in line #234 which caused the program to crash and preventing it from drawing the circle when the sailor coordinates are retrieved.
|
Thank you. I'm not sure why this is happening as I can't reproduce it in the original setup. What happens if you use sailor_x[0] rather than sailor_x.item(0)? |
|
Good morning/afternoon/evening, I've just checked sailor_x[0] - it works fine as item(0) variant in this case! |
|
Great! I need the shortest syntax possible so we don't get a line wrap in the book when it's updated in the next printing. Thanks a lot. |
|
Your book is really cool! It is hard sometimes. But it's cool1 Thank you, too. Have a nice day! |
|
Thanks. If you have any questions you can reach me through Linkedin.com. |
|
If anyone reads this and wonder what happens : rng.choice(array, size=None)returns a single value if the array is flat and a single array of n dimension if the array has n dimensions (with n > 1). But rng.choice(array, size=1)returns an array even if the shape of the array is 1. So the best option with |
|
Please see the recent update to the bayes.py code (lines 90, 91, and 234). This will hopefully clear up the problems some users have with drawing the circle. |
LINE #234 - fixed "TypeError: only integer scalar arrays can be converted to a scalar index" in line #234 which caused the program to crash and preventing it from drawing the circle when the sailor coordinates are retrieved.